Skip to content

WebSecurity#ignoring should not be warned #17316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

michaldo
Copy link

For years Spring Security exposes method WebSecurity#ignoring but pollutes logs with false positive warning.

Let's analyze my case.
Spring Security authorizes by default access to actuator endpoints and that is OK.

However, nowadays applications are often cogs in machine and is important to distinguish application responsibility and cloud/Kubernetes/service mesh responsibility.
Actuator endpoints, identical for hundreds application, should be protected by Kubernetes, not by application.
Application responsibility is configuring business endpoint access

See this snippet

httpSecurity.authorizeHttpRequests ( configurer -> configurer
                .requestMatchers("/illness/covid/statistics/2021").permitAll()
                .requestMatchers("/illness/myillness").authenticated()
---        
webSecurity.ignoring().requestMatchers("/actuator")

It clearly shows that application responsibily is expose public statistics and restrict access to private data.
And, what more important, it clearly shows that actuator access IS NOT application responsibility

I think it is more readable than

httpSecurity.authorizeHttpRequests ( configurer -> configurer
                .requestMatchers("/illness/covid/statistics/2021/europe").permitAll()
                .requestMatchers("/actuator").permitAll()
                .requestMatchers("/illness/my-illness").authenticated()

Conclusion:
I want remove warning WebSecurity#ignoring because I want promote clear, straightforwad, readable code.

For years Spring Security exposes method WebSecurity#ignoring but pollutes logs with false positive warning.

Let's analyze my case.
Spring Security authorizes by default access to actuator endpoints and that is OK.
However, nowadays applications are often cogs in machine and is important to distinguish application responsibily and cloud/Kubernetes/service mesh responsibility
Actuator endpoints, identical for hundreds application, should be protected by Kubernetes, not by application. It is not application responsibility
Application responsibility is configuring business endpoint access

See this snippet
```
httpSecurity.authorizeHttpRequests ( configurer -> configurer
                .requestMatchers("/illness/covid/statistics/2021").permitAll()
                .requestMatchers("/illness/myillness").authenticated()
---        
webSecurity.ignoring().requestMatchers("/actuator")
```
It clearly shows that application responsibily is expose publicly world statistics by restrics access to private data
And, what more important, it clearly shows that actuator access IS NOT application responsibilty

I think it is more readable than
```
httpSecurity.authorizeHttpRequests ( configurer -> configurer
                .requestMatchers("/illness/covid/statistics/2021").permitAll()
.requestMatchers("/actuator").permitAll()
                .requestMatchers("/illness/myillness").authenticated()
```

Conclusion:
I want remove warning WebSecurity#ignoring because I want promote clear, straightforwad, readable code
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 20, 2025
@rwinch
Copy link
Member

rwinch commented Jun 25, 2025

Thank you for reaching out. The warning exists because permitAll (just relates to authorization) and ignoring (disables all security - disables protection against exploits, disables access to the SecurityContext, etc) are not equivalent. Due to the fact that ignoring is so wide sweeping, we do not recommend it. Instead, use more precise controls (e.g. permitAll).

Given all of this, we are not planning on removing the warning.

@rwinch rwinch closed this Jun 25, 2025
@rwinch rwinch self-assigned this Jun 25, 2025
@rwinch rwinch added status: declined A suggestion or change that we don't feel we should currently apply in: web An issue in web modules (web, webmvc) and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 25, 2025
@michaldo
Copy link
Author

Thank for explanation.
It has a sense to encourage protecting against exploits.

But I still think that Security API does not follow current coexistence business endpoints and infrastructure (actuator) endpoints.
This two worlds should be reflected in API, rather than put one big bag

@michaldo michaldo deleted the ignore-is-cool branch June 26, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web An issue in web modules (web, webmvc) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants